package com.cts.learninglibrary.service.impl;

import com.cts.learninglibrary.mapper.LabelMapper;
import com.cts.learninglibrary.pojo.Label;
import com.cts.learninglibrary.service.LabelService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: kwanghuee
 * @date: 2020/8/18 9:59
 */
@Service
public class LabelServiceImpl implements LabelService {

    @Resource
    private LabelMapper labelMapper;

    @Override
    public List<Label> findByUserId(Integer userId) {
        return labelMapper.findByUserId(userId);
    }

    @Override
    public int addLabel(Integer userId, String labelName) {
        return labelMapper.addLabel(userId,labelName);
    }

    @Override
    public int deleteLabel(Integer id) {
        return labelMapper.deleteLabel(id);
    }

    @Override
    public int updateLabel(Integer id, Integer userId, String labelName) {
        Map map = new HashMap();
        map.put("id",id);
        map.put("userId",userId);
        map.put("labelName",labelName);
        return labelMapper.updateLabel(map);
    }
}
